<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------

/**动态修改自定义配置文件  extra 下面的文件
 *@param file 动态配置文件名称
 *@param param 配置参数  array("key"=>key,"value"=>value)
 *@return true 成功  	  false失败 
 **/
function sp_dynamic_config($file,$param){
	if(empty($file)||empty($param)){
		return FALSE;
	}
	$cache=config($file);
	$cache=array_merge($cache,$param);
	$content = "<?php\nreturn ".var_export($cache,TRUE).";"; 
	file_put_contents("./application/extra/".$file.".php", $content);
	return TRUE;
}